export function secondsToHms(ss: number) {
  const day = Math.floor(ss / 60 / 60 / 24)
  const dateString = new Date(ss * 1000).toISOString().substring(11, 19)
  const [h, m, s] = dateString.split(':').map((m) => Number(m))

  return { h: day ? day * 24 + h : h, m, s }
}

export function getStringKeys<T extends Record<string, any>>(obj: T): (keyof T)[] {
  return Object.keys(obj) as (keyof T)[]
}

export function getNumericKeys<T extends Record<number, any>>(obj: T): (keyof T & number)[] {
  return Object.keys(obj).map(Number).filter(isFinite) as (keyof T & number)[]
}
